<?php
/**********************************INCLUDE*********************************** *
* **************************************************************************** */

/**
 * This class manages return data (JSON) for 'command' scripts.
 *
 * @author nicholas malacarne <nicholas.malacarne@gmail.com>
 */
abstract class ReturnData {
    
    // stores return data for the script -nm
    private $data = array();
    
    // constructor -nm
    function __construct() {
        
    } // end method -nm
    
    // add return data -nm
    public function addData( $key, $data ){
        
        $this->data[ $key ] = $data;
        
    } // end method -nm 
    
    // return JSON response to front-end and exit script -nm
    public function returnJSON(){
        
        echo json_encode( $this->data );
        
        exit();
        
    } // end method -nm
}
